package com.redwolfsoft.libshoppingserver.brand;

import net.sf.json.JSONObject;

public class PriceInfo
{
	public final static String PRICE_INFO_TAG = "PriceInfo";
	
	public String name = null;
	public String brief = null;
	public double price = 0f;
	
	public PriceInfo(String name, String brief, double price) {
		this.name = name;
		this.brief = brief;
		this.price = price;
	}
	
	public PriceInfo(JSONObject obj)
	{
		if(obj==null)
		{
			//Log.w(TAG, "JSONObject is null");
			return;
		}
		//try {		
			name = obj.getString("name");
			brief = obj.getString("brief");
			price = obj.getDouble("price");				
			
		/*} catch (JSONException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		}*/
	}
	
	public JSONObject toJsonObject()
	{
		JSONObject obj = new JSONObject();
		//JSONObject obj2 = new JSONObject();
		//try {
			obj.put("name", name);
			obj.put("brief", brief);
			obj.put("price", price);
			
			//obj2.put(PRICE_INFO_TAG, obj);
		/*} catch (JSONException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
			return null;
		}*/
		return obj;
		
	}
}